﻿// <copyright>
// Copyright (c) 2008 - 2009, Microsoft, All Rights Reserved
// </copyright>
//
// Licensed under the Microsoft Public License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at 
//
// http://www.opensource.org/licenses/ms-pl.html

namespace LiveLabs.Logging.Logs
{
    using System;
    using System.Diagnostics.CodeAnalysis;

    /// <summary>
    /// Implementation of <see cref="Log"/> that writes to standard error.
    /// </summary>
    public class StdErrLog : Log
    {
        /// <summary>
        /// The singleton instance of StdErrLog
        /// </summary>
        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "Instance can't be changed")]
        public static readonly StdErrLog Instance = new StdErrLog();

        internal StdErrLog()
        {
        }

        /// <summary>
        /// Writes the message to <see cref="System.Console.Error"/>.
        /// </summary>
        /// <param name="message">The message to write to standard error</param>
        /// <param name="level">The level of the message.  Ignored.</param>
        public override void WriteLine(string message, LogLevel level)
        {
            Console.Error.WriteLine(message);
        }
    }
}
